﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;

namespace System.Windows.Art
{
    public sealed class Rgb : ColorSpace<RgbColor>
    {
        private static readonly Rgb singleton = new Rgb();
        private ColorChannel c0, c1, c2, c3;

        public static Rgb GetInstance()
        {
            return Rgb.singleton;
        }

        private Rgb()
            : base("Alpha", "Red", "Green", "Blue")
        {
        }

        protected override void OnChannelsAquired()
        {
            this.c0 = this.Channels[0];
            this.c1 = this.Channels[1];
            this.c2 = this.Channels[2];
            this.c3 = this.Channels[3];
        }

        public ColorChannel Alpha { get { return this.c0; } }
        public ColorChannel Red { get { return this.c1; } }
        public ColorChannel Green { get { return this.c2; } }
        public ColorChannel Blue { get { return this.c3; } }

        public override RgbColor FromColor(Color value) { return value.ToRgb(); }
    }
}
